package com.xyx.ssm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xyx.ssm.dao.UserMapper;
import com.xyx.ssm.jdbcdao.WinebrandDao;
import com.xyx.ssm.po.WineBrand;
import com.xyx.ssm.service.WinebrandService;
import com.xyx.ssm.util.Page;

@Service
public class WinebrandServiceImpl implements WinebrandService {
	@Autowired
	private UserMapper userMapper;
	@Autowired
	private WinebrandDao winebrandDao;

	public Page<Map<String, Object>> findPage(Page<Map<String, Object>> page) {
		// TODO Auto-generated method stub
		return winebrandDao.findPage(
				"com.xyx.ssm.jdbcdao.winebrandDao.SelectAllpage", page);
	}

	public int winebrandadd(WineBrand wineBrand) {
		return winebrandDao.winebrandadd(wineBrand);
	}

	@Override
	public int winebrandDelete(String ids) {
		int n = 0;
		String[] s = ids.split(",");
		for (int i = 0; i < s.length; i++) {
			Integer id = Integer.parseInt(s[i]);
			n = winebrandDao.winebrandDelete(id);
		}
		return n;
	}

	@Override
	public int winbrandUpdate(WineBrand wineBrand) {
		// TODO Auto-generated method stub
		return winebrandDao.winbrandUpdate(wineBrand);
	}

	@Override
	public List<WineBrand> winbrandId(Integer id) {
		// TODO Auto-generated method stub
		return winebrandDao.winbrandId(id);
	}

}
